import React, { useState } from 'react'
import Child1 from './Child1'
import { Context } from './context'

// #1 提供数据 Context.Provider 配合 value
export default function App() {
  const [age, setAge] = useState(18)
  const changeAge = () => {
    setAge(age + 1)
  }
  return (
    <Context.Provider
      value={{
        age,
        changeAge,
      }}
    >
      <div>
        App
        <hr />
        <Child1 />
      </div>
    </Context.Provider>
  )
}
